﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;

namespace MTGPlayer
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            if (e.Args != null && e.Args.Length > 0)
            {
                //(bool isHost, string host, int port, string name, string deck)
                try
                {
                    bool isHost;
                    Boolean.TryParse(e.Args[0], out isHost);

                    int port;
                    Int32.TryParse(e.Args[2], out port);

                    new Faust.Andrew.MTG.Player.MainWindow(isHost, e.Args[1], port, e.Args[3], e.Args[4]).ShowDialog();

                }
                catch (Exception error)
                {
                    Console.WriteLine(error.Message);
                    throw;
                }
            }
            else
            {
                new Faust.Andrew.MTG.Player.MainWindow().ShowDialog();
            }
            Shutdown();
        }
    }
}
